package domfarr.tapestry.pages;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.tapestry5.SelectModel;
import org.apache.tapestry5.ValueEncoder;
import org.apache.tapestry5.internal.OptionModelImpl;
import org.apache.tapestry5.internal.SelectModelImpl;
import org.apache.tapestry5.internal.services.StringValueEncoder;

/**
 * Start page of application tutorial1.
 */
public class Index
{
	private String greeting;
	
	private ValueEncoder<String> encoder;
	private SelectModel model;
	private List<String> selected = new ArrayList<String>();
	
	public Index() {
		encoder = new StringValueEncoder();
		model = new SelectModelImpl(new OptionModelImpl("value"));
		//selected.add("value");
	}

	public Date getCurrentTime()
	{
		return new Date();
	}
	
	void onActivate(String greeting) {
		this.greeting = greeting;
	}

	public String getGreeting() {
		return greeting;
	}

	public void setGreeting(String greeting) {
		this.greeting = greeting;
	}

	public ValueEncoder<String> getEncoder() {
		return encoder;
	}

	public void setEncoder(ValueEncoder<String> encoder) {
		this.encoder = encoder;
	}

	public SelectModel getModel() {
		return model;
	}

	public void setModel(SelectModel model) {
		this.model = model;
	}

	public List<String> getSelected() {
		return selected;
	}

	public void setSelected(List<String> selected) {
		this.selected = selected;
	}
	
	public boolean hasValue() {
		return true;
	}
}